import sys
import subprocess

def check_system():
    if sys.platform == 'linux':
        print('当前运行在Linux操作系统上')
        run_linux()
    elif sys.platform == 'darwin':
        print('当前运行在macOS操作系统上')
    elif sys.platform == 'win32':
        print('当前运行在Windows操作系统上')
        run_windows()
    else:
        print('未知的操作系统')

def run_linux():
    sh_path = 'shell/shell.sh'
    p = subprocess.Popen(['sh',sh_path],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
    if p.returncode != 0:
        print(f'Error occurred!!!')
    else:
        print(f'Successfully executed!!!')

def run_windows():
    bat_path = r'.\maxwene.bat'
    p = subprocess.Popen(bat_path,shell= True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
    if p.returncode != 0:
        print(f'Error occurred!!!')
    else:
        print(f'Successfully executed!!!')

if __name__ == "__main__":
    check_system()